package Recurion;

public class Average {

	public static void main(String[] args) {
		int a[]={1,2,3,4,5};
		System.out.println(calculateAverage(a,a.length));
	}

	public static  double calculateAverage(int a[],int n){
		if(n==1)
			return a[0];
		else
			return (double) ((a[n-1]+calculateAverage(a,n-1)*(n-1))/n);
	}
}
